home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-serious-
/
archivers
/
xfd
/
developer
/
include
/
asm
/
libraries
/
xfdmaster.i
Wrap
Text File
|
1999-05-17
|
18KB
|
421 lines
IFND LIBRARIES_XFDMASTER_I
LIBRARIES_XFDMASTER_I SET 1
**
** $VER: xfdmaster.i 39.1 (24.01.1999)
**
** Copyright © 1994-99 by Georg Hörmann, Dirk Stöcker
** All Rights Reserved
**
IFND EXEC_LIBRARIES_I
include "exec/libraries.i"
ENDC
;======================================================================
; Library Base
;======================================================================
STRUCTURE xfdMasterBase,LIB_SIZE
ULONG xfdm_SegList ; PRIVATE
APTR xfdm_DosBase ; may be used for I/O etc.
APTR xfdm_FirstSlave ; list of available slaves
APTR xfdm_FirstForeMan ; PRIVATE
ULONG xfdm_MinBufferSize ; (V36) min. bufsize for xfdRecogBuffer()
ULONG xfdm_MinLinkerSize ; (V36) min. bufsize for xfdRecogLinker()
APTR xfdm_ExecBase ; (V38.2) cached for fast access
LABEL xfdMasterBase_SIZE
XFDM_VERSION EQU 39 ;for OpenLibrary()
XFDM_NAME MACRO
dc.b "xfdmaster.library",0
ENDM
;======================================================================
; Object Types (V36)
;======================================================================
XFDOBJ_BUFFERINFO EQU 1 ; xfdBufferInfo structure
XFDOBJ_SEGMENTINFO EQU 2 ; xfdSegmentInfo structure
XFDOBJ_LINKERINFO EQU 3 ; xfdLinkerInfo structure
XFDOBJ_SCANNODE EQU 4 ; (V37) xfdScanNode structure
XFDOBJ_SCANHOOK EQU 5 ; (V37) xfdScanHook structure
XFDOBJ_MAX EQU 5 ; PRIVATE
;======================================================================
; Buffer Info
;======================================================================
STRUCTURE xfdBufferInfo,0
APTR xfdbi_SourceBuffer ; pointer to source buffer
ULONG xfdbi_SourceBufLen ; length of source buffer
APTR xfdbi_Slave ; PRIVATE
APTR xfdbi_PackerName ; name of recognized packer
UWORD xfdbi_PackerFlags ; flags for recognized packer
LABEL xfdbi_MaxSpecialLen ; max. length of special info (eg. password)
UWORD xfdbi_Error ; error return code
APTR xfdbi_TargetBuffer ; pointer to target buffer
ULONG xfdbi_TargetBufMemType ; memtype of target buffer
ULONG xfdbi_TargetBufLen ; full length of buffer
ULONG xfdbi_TargetBufSaveLen ; used length of buffer
ULONG xfdbi_DecrAddress ; address to load decrunched file
ULONG xfdbi_JmpAddress ; address to jump in file
APTR xfdbi_Special ; special decrunch info (eg. password)
UWORD xfdbi_Flags ; (V37) flags to influence recog/decr
UWORD xfdbi_Reserved0 ; (V38) PRIVATE
ULONG xfdbi_MinTargetLen ; (V38) required length of target buffer
ULONG xfdbi_FinalTargetLen ; (V38) final length of decrunched file
APTR xfdbi_UserTargetBuf ; (V38) target buffer allocated by user
ULONG xfdbi_UserTargetBufLen ; (V38) target buffer length
ULONG xfdbi_MinSourceLen ; (V39) minimum source length (tested
; by master library)
LABEL xfdBufferInfo_SIZE
;======================================================================
; Segment Info
;======================================================================
STRUCTURE xfdSegmentInfo,0
ULONG xfdsi_SegList ; value received by LoadSeg()
APTR xfdsi_Slave ; PRIVATE
APTR xfdsi_PackerName ; name of recognized packer
UWORD xfdsi_PackerFlags ; flags for recognized packer
LABEL xfdsi_MaxSpecialLen ; max. length of special info (eg. password)
UWORD xfdsi_Error ; error return code
APTR xfdsi_Special ; special decrunch info (eg. password)
UWORD xfdsi_RelMode ; (V34) relocation mode
UWORD xfdsi_Flags ; (V37) flags to influence recog/decr
LABEL xfdSegmentInfo_SIZE
;======================================================================
; Linker Info (V36)
;======================================================================
STRUCTURE xfdLinkerInfo,0
APTR xfdli_Buffer ; pointer to buffer
ULONG xfdli_BufLen ; length of buffer
APTR xfdli_LinkerName ; name of recognized linker
FPTR xfdli_Unlink ; PRIVATE
UWORD xfdli_Reserved ; set to NULL
UWORD xfdli_Error ; error return code
ULONG xfdli_Hunk1 ; PRIVATE
ULONG xfdli_Hunk2 ; PRIVATE
ULONG xfdli_Amount1 ; PRIVATE
ULONG xfdli_Amount2 ; PRIVATE
APTR xfdli_Save1 ; pointer to first unlinked file
APTR xfdli_Save2 ; pointer to second unlinked file
ULONG xfdli_SaveLen1 ; length of first unlinked file
ULONG xfdli_SaveLen2 ; length of second unlinked file
LABEL xfdLinkerInfo_SIZE
;======================================================================
; Scan Node (V37)
;======================================================================
STRUCTURE xfdScanNode,0
APTR xfdsn_Next ; pointer to next xfdScanNode structure (or NULL)
APTR xfdsn_Save ; pointer to data
ULONG xfdsn_SaveLen ; length of data
APTR xfdsn_PackerName ; name of recognized packer
UWORD xfdsn_PackerFlags ; flags for recognized packer
LABEL xfdScanNode_SIZE
;======================================================================
; Scan Hook (V37)
;======================================================================
STRUCTURE xfdScanHook,0
APTR xfdsh_Entry ; entrypoint of hook code
APTR xfdsh_Data ; private data of hook
ULONG xfdsh_ToDo ; bytes still to scan (READ ONLY)
ULONG xfdsh_ScanNode ; found data right now (or NULL) (READ ONLY)
LABEL xfdScanHook_SIZE
;======================================================================
; Error Codes
;======================================================================
XFDERR_OK EQU $0000 ; no error
XFDERR_NOMEMORY EQU $0001 ; error allocating memory
XFDERR_NOSLAVE EQU $0002 ; no slave entry in info structure
XFDERR_NOTSUPPORTED EQU $0003 ; slave doesn't support called function
XFDERR_UNKNOWN EQU $0004 ; unknown file
XFDERR_NOSOURCE EQU $0005 ; no sourcebuffer/seglist specified
XFDERR_WRONGPASSWORD EQU $0006 ; wrong password for decrunching
XFDERR_BADHUNK EQU $0007 ; bad hunk structure
XFDERR_CORRUPTEDDATA EQU $0008 ; crunched data is corrupted
XFDERR_MISSINGRESOURCE EQU $0009 ; (V34) missing external resource (eg. libs)
XFDERR_WRONGKEY EQU $000a ; (V35) wrong 16/32 bit key
XFDERR_BETTERCPU EQU $000b ; (V37) better CPU required
XFDERR_HOOKBREAK EQU $000c ; (V37) hook caused break
XFDERR_DOSERROR EQU $000d ; (V37) dos error
XFDERR_NOTARGET EQU $000e ; (V38) no user target given
XFDERR_TARGETTOOSMALL EQU $000f ; (V38) user target is too small
XFDERR_TARGETNOTSUPPORTED EQU $0010 ; (V38) user target not supported
XFDERR_UNDEFINEDHUNK EQU $1000 ; (V34) undefined hunk type
XFDERR_NOHUNKHEADER EQU $1001 ; (V34) file is not executable
XFDERR_BADEXTTYPE EQU $1002 ; (V34) bad hunk_ext type
XFDERR_BUFFERTRUNCATED EQU $1003 ; (V34) unexpected end of file
XFDERR_WRONGHUNKAMOUNT EQU $1004 ; (V34) wrong amount of hunks
XFDERR_NOOVERLAYS EQU $1005 ; (V36) overlays not allowed
XFDERR_UNSUPPORTEDHUNK EQU $2000 ; (V34) hunk type not supported
XFDERR_BADRELMODE EQU $2001 ; (V34) unknown XFDREL_#? mode
;======================================================================
; Relocation modes (V34)
;======================================================================
XFDREL_DEFAULT EQU $0000 ; use memory types given by hunk_header
XFDREL_FORCECHIP EQU $0001 ; force all hunks to chip ram
XFDREL_FORCEFAST EQU $0002 ; force all hunks to fast ram
;======================================================================
; Values for xfd??_PackerFlags
;======================================================================
BITDEF XFDPF,RELOC,0 ; relocatible file packer
BITDEF XFDPF,ADDR,1 ; absolute address file packer
BITDEF XFDPF,DATA,2 ; data file packer
BITDEF XFDPF,PASSWORD,4 ; packer requires password
BITDEF XFDPF,RELMODE,5 ; (V34) decruncher supports xfdsi_RelMode
BITDEF XFDPF,KEY16,6 ; (V35) packer requires 16 bit key
BITDEF XFDPF,KEY32,7 ; (V35) packer requires 32 bit key
BITDEF XFDPF,RECOGLEN,8 ; (V38) slave recognizes target lengths
BITDEF XFDPF,USERTARGET,9 ; (V38) slave supports user target buffer
BITDEF XFDPF,EXTERN,15 ; (V37) PRIVATE
;======================================================================
; Values for xfd??_Flags (V37)
;======================================================================
BITDEF XFDF,RECOGEXTERN,0 ; xfdRecog#?() uses external slaves
BITDEF XFDF,RECOGTARGETLEN,1 ; (V38) xfdRecogBuffer() uses only slaves
; that recognize target lengths
BITDEF XFDF,RECO